package gclib.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 *
 * @author Jason
 */
@Entity
@Table(name="GC_ABILITY")
public class Ability implements Serializable{

    @Id
    @Enumerated(EnumType.STRING)
    @Column(name="ABILITY")
    private AbilityType abilityType;

    @Basic
    @Column(name="SCORE")
    private Integer score = 0;

    public Ability() {
    }

    public AbilityType getAbilityType() {
        return abilityType;
    }

    public void setAbilityType(AbilityType abilityType) {
        this.abilityType = abilityType;
    }

    public Integer getScore() {
        return score;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    /**
     * {@inheritDoc }
     * @param obj
     * @return
     */
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Ability other = (Ability) obj;
        if (this.abilityType != other.abilityType) {
            return false;
        }
        return true;
    }

    /**
     * {@inheritDoc }
     * @return
     */
    @Override
    public int hashCode() {
        int hash = 7;
        hash = 89 * hash + (this.abilityType != null ? this.abilityType.hashCode() : 0);
        hash = 89 * hash + (this.score != null ? this.score.hashCode() : 0);
        return hash;
    }

    /**
     * Returns a String representative of an Ability.
     * @return
     */
    @Override
    public String toString() {
        StringBuilder result = new StringBuilder("Ability [");
        result.append("abilityType:").append(abilityType).append(", ");
        result.append("score:").append(score);
        return result.append(']').toString();
    }
}
